package memoire;

public class Maree {
	private int coeff;
	private int heurePM;
	private final float[] niveauMaree45 = { 7, 6.9f, 6.8f, 6.7f, 6.47f, 6.23f,
			6, 5.66f, 5.33f, 5, 4.66f, 4.33f, 4, 3.73f, 3.47f, 3.2f, 3.13f,
			3.07f, 3 };
	private final float[] niveauMaree60 = { 8, 7.83f, 7.67f, 7.5f, 7.17f,
			6.83f, 6.5f, 6, 5.5f, 5, 4.5f, 4, 3.5f, 3.16f, 2.83f, 2.5f, 2.33f,
			2.17f, 2 };
	private final float[] niveauMaree95 = { 9, 8.83f, 8.66f, 8.5f, 8, 7.5f, 7,
			6.33f, 5.67f, 5, 4.33f, 3.67f, 3, 2.5f, 2, 1.5f, 1.33f, 1.17f, 1 };

	public Maree() {
		coeff = 0;
		heurePM = 0;
	}

	public Maree(int coeff, int heurePM) {
		this.coeff = coeff;
		this.heurePM = heurePM;
	}

	public int getCoeff() {
		return coeff;
	}

	public void setCoeff(int coeff) {
		this.coeff = coeff;
	}

	public int getHeurePM() {
		return heurePM;
	}

	public void setHeurePM(int heurePM) {
		this.heurePM = heurePM;
	}

	public float getNiveauMaree(int minutes) {
		int min = 0;
		minutes = minutes%720 ;
		minutes = minutes - heurePM * 60;
		if (minutes <= 360)
			min = minutes / 20;
		else if ((360 <= minutes) && (minutes <= 720))
			min = (720 - minutes) / 20;
		else if (minutes >= 720)
			min = (minutes % 720) / 20;

		switch (coeff) {
		case 1:
			return niveauMaree45[min];
		case 2:
			return niveauMaree60[min];
		case 3:
			return niveauMaree95[min];
		default:
			return 0;
		}

	}

}
